import './assets/main.css'
import 'animate.css';
import 'element-plus/es/components/message/style/css'
import 'nprogress/nprogress.css'
// 引入全局状态管理 Pinia
import pinia from '@/stores'
import { createApp } from 'vue'
import App from '@/App.vue'
import '@/assets/main.css'
import router from '@/router'
// 导入全局路由守卫
import '@/permission'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'viewerjs/dist/viewer.css'
import VueViewer from 'v-viewer'
// 导入 element-plus 暗黑 css
import 'element-plus/theme-chalk/dark/css-vars.css'
import { showMessage } from '@/composables/util'

const app = createApp(App)
app.use(router)
// 应用 Pinia
app.use(pinia)


for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// 全局错误处理
app.config.errorHandler = (err, instance, info) => {
    // 可以在这里添加错误上报逻辑
    showMessage("操作异常，请联系博主！", 'error')
}
app.use(VueViewer)
app.mount('#app')
